package sctu.edu.java.year2016.team01.xuhanmei.day20160530.chapter9_1;

/**
 * Created by Administrator on 2016/5/30.
 * * 创建一个类，并在类中创建一个成员内部类，通过成员内部类计算1到任意
 * 数的和的操作，并在外部类中进行测试
 */

import java.util.Scanner;

public class Calculate1 {


    public static void main(String[] args) {

        System.out.println("请输入您想要求和的值：");
        Scanner scan = new Scanner(System.in);

        //int n=scan.nextInt();
        //int sum0=0;


        class sum {
            int i = 1;
            //int n=9;

            int n = scan.nextInt();

            int sum0 = 0;

            public void f() {
                while (this.i <= this.n) {
                    sum0 += i;
                    i++;
                }
                System.out.println(sum0);
            }

        }
        sum in = new sum();
        in.f();
    }
}
